package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.check.dutyperson;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.check.dutyperson.DutyPersonService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * 值班人员控制器
 */
@Action
@RequestMapping(value="check/dutyPerson")
public class DutyPersonController extends BaseController {
    @Resource
    public DutyPersonService dutyPersonService;

    /**
     * 值班人员列表
     * @param
     * page	第几页
     * businessId	单位id：如果是机构用户登录需要传,如果是单位用户自己取
     * limit	每页多少条
     * @return
     */
    @At(value = "dutyPersonListPage", method = RequestMethod.GET, param = { "page","limit"})
    public RespEntity dutyPersonListPage(@RequestBody(required = false) JSONObject jsonParam) {
        return dutyPersonService.dutyPersonListPage(jsonParam);
    }

    /**
     * 值班人员详情
     * @param  id	值班人员的id
     * @return
     */
    @At(value = "dutyPersonDetail", method = RequestMethod.GET, param = { "id"})
    public RespEntity dutyPersonDetail(@RequestBody(required = false) JSONObject jsonParam) {
        return dutyPersonService.dutyPersonDetail(jsonParam);
    }

    /**
     * 值班人员新增
     * @param
     * accountname	关联的用户名
     * name	姓名
     * post	职务
     * tel	办公电话
     * phone	手机号码
     * img	图片路径
     * @return
     */
    @At(value = "dutyPersonAdd", method = RequestMethod.POST, param = { "accountname","name","phone" })
    public RespEntity dutyPersonAdd(@RequestBody(required = false) JSONObject jsonParam) {
        return dutyPersonService.dutyPersonAdd(jsonParam);
    }

    /**
     * 值班人员修改
     * @param
     * accountname	关联的用户名
     * name	姓名
     * post	职务
     * tel	办公电话
     * phone	手机号码
     * id	值班人员id
     * img	图片路径
     * @return
     */
    @At(value = "dutyPersonUpdate", method = RequestMethod.POST, param = { "accountname","name","phone","id" })
    public RespEntity dutyPersonUpdate(@RequestBody(required = false) JSONObject jsonParam) {
        return dutyPersonService.dutyPersonUpdate(jsonParam);
    }

    /**
     * 值班人员删除
     * @param   id	值班人员的id
     * @return
     */
    @At(value = "dutyPersonDelete", method = RequestMethod.POST, param = { "id" })
    public RespEntity dutyPersonDelete(@RequestBody(required = false) JSONObject jsonParam) {
        return dutyPersonService.dutyPersonDelete(jsonParam);
    }

    /**
     * 值班人员不分页列表
     * @param
     * @return
     */
    @At(value = "dutyPersonListNoPage", method = RequestMethod.GET)
    public RespEntity dutyPersonListNoPage(@RequestBody(required = false) JSONObject jsonParam) {
        return dutyPersonService.dutyPersonListNoPage(jsonParam);
    }

    /**
     * 判断是否需要值班，就是是否为值班人员，是否显示值班按钮，以及显示什么按钮
     * @param
     * @return
     */
    @At(value = "isNeedDuty", method = RequestMethod.GET)
    public RespEntity isNeedDuty(@RequestBody(required = false) JSONObject jsonParam) {
        return dutyPersonService.isNeedDuty(jsonParam);
    }

    /**
     * 开始值班
     * @param
     * @return
     */
    @At(value = "startDuty", method = RequestMethod.POST)
    public RespEntity startDuty(@RequestBody(required = false) JSONObject jsonParam) {
        return dutyPersonService.startDuty(jsonParam);
    }

    /**
     * 结束值班
     * @param
     * @return
     */
    @At(value = "endDuty", method = RequestMethod.POST)
    public RespEntity endDuty(@RequestBody(required = false) JSONObject jsonParam) {
        return dutyPersonService.endDuty(jsonParam);
    }

    /**
     * 值班记录
     * @param
     * @return
     */
    @At(value = "getDutyRecord", method = RequestMethod.GET, param = { "page","limit"})
    public RespEntity getDutyRecord(@RequestBody(required = false) JSONObject jsonParam) {
        return dutyPersonService.getDutyRecord(jsonParam);
    }

    /**
     * 现在正在值班人员
     * @param
     * @return
     */
    @At(value = "nowDutyPerson", method = RequestMethod.GET, param = { "page","limit"})
    public RespEntity nowDutyPerson(@RequestBody(required = false) JSONObject jsonParam) {
        return dutyPersonService.nowDutyPerson(jsonParam);
    }






   
}